/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: dings
 * Date: 2024-06-29
 * Time: 20:07
 */
abstract class Animal {
    private String name;
    private int age;

    public Animal() {
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public abstract void eat();

}
public class Test {
    public static void test(Animal animal) {
        animal.eat();
    }
    public static void main(String[] args) {
        test(new Animal("旺财",2) {
            @Override
            public void eat() {
                System.out.println(this.getName()+"正在吃饭");
            }
        });
    }
}
